package com.wusir.service;

import com.wusir.mapper.TeacherMapper;
import com.wusir.pojo.Teacher;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherService {

    @Resource
    private TeacherMapper teacherMapper;

    /**
     * 插入教师信息
     *
     * @param teacher 需要插入的教师信息对象
     */
    public void insertTeacher(Teacher teacher) {
        teacherMapper.insertTeacher(teacher);
    }

    /**
     * 根据教师ID删除教师信息
     *
     * @param id 需要删除的教师ID
     */
    public void deleteTeacher(Integer id) {
        teacherMapper.deleteTeacher(id);
    }

    /**
     * 更新教师信息
     *
     * @param teacher 需要更新的教师信息对象
     * @return 如果更新成功返回true，否则返回false
     */
    public boolean updateTeacher(Teacher teacher) {
        return teacherMapper.updateTeacher(teacher);
    }

    /**
     * 获取所有教师信息
     *
     * @return 教师信息列表
     */
    public List<Teacher> selectTeacherAll() {
        return teacherMapper.selectTeacherAll();
    }

    /**
     * 根据教师ID查询教师信息
     *
     * @param id 教师ID
     * @return 对应的教师信息对象，如果未找到则返回null
     */
    public Teacher selectTeacherById(Integer id) {
        return teacherMapper.selectTeacherById(id);
    }
}

